home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-10-23 | 3.2 KB | 135 lines | [TEXT/CWIE] |
- // EditFields.cp -- Modal dialog
-
- #include <Types.h>
- #include <Quickdraw.h>
- #include <Controls.h>
- #include <Dialogs.h>
- #include <Events.h>
- #include <Lists.h>
- #include <Menus.h>
- #include <TextEdit.h>
- #include <Appearance.h>
-
- #include "ResourceDefs.h"
- #include "Miscellany.h"
- #include "ControlUtils.h"
-
- #include "EditFields.h"
-
- #define kOKButton 1
- #define kCancelButton 2
- #define kThePictureAndCaptionAreInLabel 3
- #define kFullLengthLabel 4
- #define kFBFullLengthField 5
- #define kBodyWidthLabel 6
- #define kFBBodyWidthField 7
- #define kShoulderSlopeLabel 8
- #define kFBShSlopeField 9
- #define kPictureAndTextGroup 10
- #define kFullLength2Layer 11
- #define kFullLengthPictImage 12
- #define kFromHighShoulderOverBustTLabel 13
- #define kBodyWidth2Layer 14
- #define kBodyWidthPictImage 15
- #define kSideSeamToSideSeam12InchBLabel 16
- #define kShoulderSlope2Layer 17
- #define kShoulderSlopePictImage 18
- #define kShoulderEdgeOverBustToCenLabel 19
-
-
- //----------
- // static
- Boolean CEditFields::GetEditFields (
- DEditFieldsData* ioData)
- {
- Boolean result = false;
- CEditFields* dialog = new CEditFields;
-
- result = dialog->RunModal (DLOG_EditFields, ioData);
-
- delete dialog;
-
- return result;
- }
-
- //----------
- CEditFields::CEditFields ()
- {
- mData = nil;
- }
-
- //----------
- CEditFields::~CEditFields ()
- {
- }
-
- //----------
- void CEditFields::FinishMake ()
- {
- mOKHandle = GetControlItem (kOKButton);
- SetDefaultState (mOKHandle, true);
- ::SetDialogDefaultItem (mDialog, kOKButton);
- mCancelHandle = GetControlItem (kCancelButton);
- ::SetDialogCancelItem (mDialog, kCancelButton);
- mFBFullLengthHandle = GetControlItem (kFBFullLengthField);
- mFBBodyWidthHandle = GetControlItem (kFBBodyWidthField);
- mFBShSlopeHandle = GetControlItem (kFBShSlopeField);
- mPictureAndTextHandle = GetControlItem (kPictureAndTextGroup);
- }
-
- //----------
- void CEditFields::ConnectToData (
- AMSignaler* inData)
- {
- AMDialog::ConnectToData (inData);
- mData = (DEditFieldsData*) inData;
-
- SetControlTextFloat (mFBFullLengthHandle, mData->GetFBFullLength ());
- SetControlTextFloat (mFBBodyWidthHandle, mData->GetFBBodyWidth ());
- SetControlTextFloat (mFBShSlopeHandle, mData->GetFBShSlope ());
- SetLayerGroupValue (mPictureAndTextHandle, mData->GetEditingWhat ());
- }
-
- //----------
- void CEditFields::DataChanged (
- long inDataID)
- {
- if (inDataID == idFBFullLength) {
- SetControlTextFloat (mFBFullLengthHandle, mData->GetFBFullLength ());
- }
- if (inDataID == idFBBodyWidth) {
- SetControlTextFloat (mFBBodyWidthHandle, mData->GetFBBodyWidth ());
- }
- if (inDataID == idFBShSlope) {
- SetControlTextFloat (mFBShSlopeHandle, mData->GetFBShSlope ());
- }
- if (inDataID == idEditingWhat) {
- SetLayerGroupValue (mPictureAndTextHandle, mData->GetEditingWhat ());
- }
- }
-
-
- //----------
- void CEditFields::DoItem (
- SInt16 inItemHit)
- {
- switch (inItemHit) {
- case kOKButton:
- SetResult (true);
- break;
- case kCancelButton:
- SetResult (false);
- break;
- case kFBFullLengthField:
- mData->SetFBFullLength (GetControlTextFloat (mFBFullLengthHandle));
- break;
- case kFBBodyWidthField:
- mData->SetFBBodyWidth (GetControlTextFloat (mFBBodyWidthHandle));
- break;
- case kFBShSlopeField:
- mData->SetFBShSlope (GetControlTextFloat (mFBShSlopeHandle));
- break;
-
- } // switch
- }
-